#include "Player.h"
#include "../Map/Zone.h"
#include "../../Render/TextureManager.h"

Player::Player(void)
{
	// this is for a basic start. never to go under 0. may modify later.
	m_Strength = 5;
	m_Perception = 5;
	m_Endurance = 5;
	m_Charisma = 5;
	m_Intelligence = 5;
	m_Agillity = 5;
	m_Luck = 5;
	m_Score = 0;

	DWORD key = ColorToKey(0xFF,0xFF,0xFF);
	int imgID = TextureManager::GetInstance()->LoadTeture("../Resource/Knight.png", key);
	SetImageID(imgID);
}

Player::~Player(void)
{

}

void Player::Update(float deltaTime)
{
	
}

void Player::Render(void)
{
	int midX = (m_ImageWidth/2);
	int midY = (m_ImageHeight/2);

	m_Camera->Draw(m_ImageID, ((int)m_BasePositionX)-midX, ((int)m_BasePositionY)-midY, 1.0f, 1.0f, NULL, (float)midX, (float)midY);
}

void Player::Input(void)
{
	InputManager* input = InputManager::GetInstance();

	if(input->InputDown("UP"))
	{
		m_BasePositionY -= 5;
	}

	if(input->InputDown("DOWN"))
	{
		m_BasePositionY += 5;
	}

	if(input->InputDown("LEFT"))
	{
		m_BasePositionX -= 5;
	}

	if(input->InputDown("RIGHT"))
	{
		m_BasePositionX += 5;
	}
}

//bool Player::CheckNieghbor(int Direction)
//{
//	return m_Zone->CheckNeighbor(Direction);
//}

void Player::Score(void)
{
	m_Score++;
}

int Player::GetScore(void)
{
	return m_Score;
}